package cn.iocoder.yudao.module.member.alliance.controller.app;

import cn.iocoder.yudao.framework.business.eligibility.controller.EligibilityApplyController;
import cn.iocoder.yudao.framework.business.eligibility.pojo.vo.EligibilityApplyCheckVO;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.api.member.alliance.vo.CloudAllianceApplyVO;
import cn.iocoder.yudao.module.member.alliance.service.CloudAllianceApplyService;
import cn.iocoder.yudao.module.member.alliance.vo.AppCloudAllianceApplySaveDTO;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

@Tag(name = "用户 App - 云盟商申请")
@RestController
@RequestMapping("/member/cloud-alliance-apply")
public class AppCloudAllianceApplyController implements EligibilityApplyController<CloudAllianceApplyVO, AppCloudAllianceApplySaveDTO> {

    @Resource
    private CloudAllianceApplyService cloudAllianceApplyService;

    @Override
    public CommonResult<EligibilityApplyCheckVO<CloudAllianceApplyVO>> check() {
        EligibilityApplyCheckVO<CloudAllianceApplyVO> respVO = cloudAllianceApplyService.check(getLoginUserId(), null);
        return success(respVO);
    }

    @Override
    public CommonResult<Long> apply(AppCloudAllianceApplySaveDTO reqVO) {
        Long id = cloudAllianceApplyService.apply(getLoginUserId(), null, reqVO);
        return success(id);
    }

}
